@extends('layouts.console_header')

@section('title', '个人地推方案详情')

@section('resources')
    @parent
<style>
	.user_salesman_edit{float: right;color: #9955c6;cursor: pointer;}
	.details1{background-color: #fff;border-radius: 5px;padding: 1px 15px;}
	.user_setup_details{font-size: 14px;padding: 0 15px;}
	.user_setup_details li{border-bottom: 1px solid #eee;padding: 20px 0;overflow: hidden;}
	.user_setup_details li .contant{float: left;width: 680px;}
	.user_setup_details li .front{float: left;}
	.user_list .details1 .salesman_history{border: none;}
	.salesman_history a{color: #9955c6;}
    .display{text-align: center;background-color: #fff;border-collapse:collapse;}
    .display th{padding: 20px 0;}
    .display #tbody_content{border-top: 1px solid #000;border-bottom: 1px solid #000;font-size: 14px;}
    .display #tbody_content tr:nth-child(2n+1){border-bottom: 1px solid #ddd;background-color: #f9f9f9;}
    .display #tbody_content tr:nth-child(2n){border-bottom: 1px solid #ddd;}
    .display #tbody_content tr td{padding: 10px 0;}
    .display #tbody_content tr td:nth-child(1){background-color: #f1f1f1;}
    .shop_title{height: 50px;line-height: 50px;border-bottom: 1px solid #333;}
    .shop_title p{width: 400px;text-align: center;}
    .shop_title img{width: 30px;margin: 10px;cursor: pointer;}
    .shop_eweima{position: fixed;top: 200px;left: 50%;width: 450px;padding-bottom: 10px;margin-left: -225px;background-color: #fff;border: 1px solid #333;display: none;z-index: 1001;}
    .shop_eweima_content li{text-align: center;margin: 10px;}
</style>
@endsection

@section('content')
<section class="user_list">
	<div style="border-bottom: 2px solid #9955c6;overflow: hidden;">
        <p class="fz_14 account_title fl" style="border: none;">
            <span style="color: #7f7f7f;"><a href="/console/index">首页</a>>地推管理><a href="/console/salesman/setup">地推设置</a>></span>
            <span class="co_violet">个人地推方案详情</span>
        </p>
        <a onclick="history.go(-1);" href="#"><p class="fr tc back_btn">返回</p></a>
    </div>
	<!-- 个人地推 -->
    <div class="details1" style="margin-top: 20px;">
        <p style="overflow: hidden;margin: 10px 0;">
            <span style="float: left;">个人地推方案详情</span>
            <a href="/console/salesmanset/user/new?cityid={{$cityid}}&salesmansetid={{$salesmansetid}}" class="user_salesman_edit">编辑</a>
        </p>
        <ul class="user_setup_details">
            <li class="user_setup_name">
                <span>生效时间：</span>
            @if($basicinfo['status'] == 1)
                <span> {{date('Y-m-d', strtotime($basicinfo['created_at']))}}至今</span>
            @else
                <span>{{date('Y-m-d', strtotime($basicinfo['created_at']))}} 至 {{date('Y-m-d', strtotime($basicinfo['updated_at']))}}</span>
            @endif
            </li>
            <li class="user_setup_name">
                <span>地推名称：</span>
                <span>{{$basicinfo['name']}}</span>
            </li>
            <li class="user_setup_name">
                <span>结算周期：</span>
                <span>{{$basicinfo['accountperioddescription']}}</span>
            </li>
            <li>
                <span class="front">有效地推定义：</span>
                <span class="contant">{{$basicinfo['showvalidsalesman']}}</span>
            </li>
            <li>
                <span class="front">个人地推结算：</span>
                <span class="contant">{{$basicinfo['showaccountmethod']}}</span>
            </li>
            <li class="salesman_history">
                <a href="/console/salesman/setup/history?cityid={{$cityid}}">历史设置记录>></a>
            </li>
        </ul>
    </div>
    <div class="details1" style="margin-top: 20px;">
        <p style="overflow: hidden;margin: 10px 0;">
            <span style="float: left;">地推人员</span>
        </p>
        <table class="display" cellspacing="0" width="100%">
            <thead>
                <tr>
                    <th>序号</th>
                    <th>个人地推账号</th>
                    <th>姓名</th>
                    <th>二维码编号</th>
                    <th>注册用户数</th>
                    <th>地推收入(元)</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody id="tbody_content">
                @foreach($usersalesmanlist as $list)
                <tr>
                @if(!isset($i))
                    <td>{{$i=1}}</td>
                @else
                    <td>{{++$i}}</td>
                @endif
                    <td>{{$list['mobile']}}</td>
                    <td>{{$list['name']}}</td>
                    <td>{{$list['qrcode']}}</td>
                    <td>{{$list['registernum']}}</td>
                    <td>{{$list['totalmoney']}}</td>
                @if($list['status'] == 1)
                    <td>可用</td>
                @else
                    <td>不可用</td>
                @endif
                    <td>
                        <a style="color: #9955c6;" href="/console/salesman/user/details?cityid={{$cityid}}&salesmanid={{$list['salesmanid']}}">详情</a>
                        <a href="#" onclick="shop_eweima('{{$list['mobile']}}', '{{$list['name']}}', '{{$list['qrcode']}}')">二维码</a>
                    </td>
                </tr>
                @endforeach
            </tbody>
        </table>
	</div>
    <div class="shop_eweima">
        <div class="shop_title oh">
            <p class="fl">个人地推二维码</p>
            <img class="fr shop_close" src="{{env('IMAGE_DOMAIN')}}images/close_p.png" alt="">
        </div>
        <ul class="shop_eweima_content">
            <li id="output"></li>
            <li class="co_violet" style="font-size: 20px;"><span class="eweimashopname"></span></li>
        </ul>
    </div>
</section>
@endsection

@section('scriptResources')
    @parent
    <script type="text/javascript" src="{{env('JS_DOMAIN')}}js/jquery.qrcode.min.js"></script>
    <script>
        var web_url = "{{env('WEB_URL')}}";
        var salesman_set_id = "{{$salesmansetid}}";
    	// 二维码  
        function shop_eweima(mobile, name, qrcode){
            $('#output').html("");
            $(".eweimashopname").text(name+'('+mobile+')');
            $(".shop_eweima").show();
            $(".public_prompt_mark").show();
            $(".public_prompt_mark").height($(window).height());
            var qrcodeurl = web_url + "qrcode/user/" + qrcode;
            //var qrcodeurl = "https://www.fbw-china.com";
            $('#output').qrcode(qrcodeurl);
        };
        $(".shop_close").click(function(){
            $(".shop_eweima").hide();
            $(".public_prompt_mark").hide();
        })
    </script>
@endsection